lib/sign: fix the false failure while loading keys
authorDenis Pynkin <denis.pynkin@collabora.com>
Mon, 25 Nov 2019 19:53:28 +0000 (22:53 +0300)
committerDenis Pynkin <denis.pynkin@collabora.com>
Wed, 25 Mar 2020 12:23:55 +0000 (15:23 +0300)
Usage of 'g_warning()' inside keys loading funcrion lead to false
failure: the key loading attempt for the wrong engine breaks the
pulling process instead of trying to use this key with correct engine.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
src/libostree/ostree-repo-pull.c

index 4dd0f11abff351566a8ff0c2486ec447550bafee..78bb32f30d6899090afca8d8839b36f7d35fb98f 100644 (file)
@@ -1492,7 +1492,6 @@ _load_public_keys (OtPullData *pull_data,
   gboolean loaded_inlined = TRUE;
   g_autoptr (GError) error = NULL;
 
-  /* Load keys for remote from file */
   ostree_repo_get_remote_option (pull_data->repo,
                                  pull_data->remote_name,
                                  "verification-file", NULL,
@@ -1531,12 +1530,9 @@ _load_public_keys (OtPullData *pull_data,
         loaded_from_file = TRUE;
       else
         {
-          if (error == NULL)
-            g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                                 "unknown reason");
-
-          g_warning("Unable to load public keys from file '%s': %s",
-                    pk_file, error->message);
+          g_assert (error);
+          g_debug("Unable to load public keys for '%s' from file '%s': %s",
+                  ostree_sign_get_name(sign), pk_file, error->message);
           g_clear_error (&error);
         }
     }
@@ -1557,8 +1553,8 @@ _load_public_keys (OtPullData *pull_data,
             g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
                                  "unknown reason");
 
-          g_warning("Unable to load public key '%s': %s",
-                    pk_ascii, error->message);
+          g_debug("Unable to load public key '%s' for '%s': %s",
+                  pk_ascii, ostree_sign_get_name(sign), error->message);
           g_clear_error (&error);
         }
     }